Xbasic

SQL::QueryValidate Method

Syntax

Result_Flag as L = Validate([SQLConnection as [SQL::Connection | C] [, UpdateStatistics as L])

Arguments

SQLConnectionSQL::ConnectionCharacter

A connection string or SQL::Connection object with a defined .ConnectionString property.

UpdateStatisticsLogical

A true or false value.

Returns

Result_FlagLogical

Returns .t. if the operation was successful. Otherwise, .f..

Description

Execute the current statement using the current or passed connection.

Discussion

The .Validate() method prepares the query and validates it, but does not execute it. (In some implementations the query is executed with a limit on rows set to 1). The intent is to force the query through a server side parse and report problems. If successful, the SQL::Query.ResultSet property has a full definition of the columns that would be returned including the underlying table from which the column would be retrieved. The augmentation of the result set with this information is expensive, so it is intended as a design-time tool, not as a run-time option.

The method connects to the back-end database using the information in the SQL::Connection::ConnectionString property or in the ConnectString string, then executes the current SQL statement stored in the SQL::Query.SQLStatement property.

Not every database is thorough about validation.

See Also